home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11178 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Pointers to register
  5. Date: 22 Mar 1996 06:34:31 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4iu6on$nt5@solutions.solon.com>
  8. References: <1239@altheim.win-uk.net> <4iklpm$28s@sparcserver.lrz-muenchen.de> <1247@altheim.win-uk.net>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <1247@altheim.win-uk.net>,
  12. Brian R. Oldham <broldham@altheim.win-uk.net> wrote:
  13. >Yes Kurt, I think I've got the message by now. But where you guys keep
  14. >missing the point (like Nottm Forest kept missing the Bayern Munich
  15. >goalposts :-{ ) is that if declaration:
  16.  
  17. >    *ptr = var;
  18.     
  19. >is wrong for other objects in memory then why does it work for:
  20.  
  21. >    *ptr = union_member;
  22.  
  23. It's not wrong for other objects in memory; it's merely not a declaration.
  24. *ptr = var; means "assuming that ptr already points correctly to something
  25. of the same type as var, copy from var into the area pointed at."
  26. So, *ptr = union_member should work.
  27.  
  28. >And why does my compiler complain at the correct way:
  29.  
  30. >    ptr = &union_member;
  31.  
  32. Because this does a much different thing.
  33.     ptr = &var;
  34. means "cause ptr to point at this particular object".  This is obviously
  35. invalid for a register object, which is not in memory.  :)
  36.  
  37. -s
  38. -- 
  39. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  40. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  41. FUCK the communications decency act.  Goddamned government.  [literally.]
  42. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  43.